@include('admin::layouts.header')
<div class="admin-main layui-anim layui-anim-upbit">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>评论管理</legend>
    </fieldset>
	<div class="demoTable layui-row">
		<div class="layui-form layui-form-pane" style="float:left;">
			<div class="layui-form-item">
				<label class="layui-form-label">快捷查询</label>
				<div class="layui-input-inline layui-form">
					<input class="layui-input" name="title" id="title" placeholder="请输入文章标题">
				</div>
			</div>
        </div>
		<div class="layui-form layui-form-pane" style="float:left;width:460px">
			<div class="layui-form-item">
				<label class="layui-form-label">评论时间</label>
				<div style="width:72%" class="layui-input-inline layui-form">
					<input style="width:100%" type="text" class="layui-input" id="created_at" placeholder="请选择时间">
				</div>
			</div>	
		</div>
    </div>
	<div class="demoTable layui-row">
		<button class="layui-btn" style="margin-left:30px;margin-top:15px;" id="search" data-type="reload">查询</button>
		<a href="{{route('blog_admin.comment.index')}}" style="margin-top:15px;" class="layui-btn">重置</a>
	</div>
    <table class="layui-table" id="list" lay-filter="list"></table>
</div>
@include('admin::layouts.footer')
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="topBtn">
   <button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="delAll()">批量删除</button>
</script>
<script>
    layui.use(['table','form'], function() {
        var table = layui.table,form = layui.form,$ = layui.jquery;
        var tableIn = table.render({
			id: 'ad',
            elem: '#list',
            url: "{{route('blog_admin.comment.data')}}",
            method:'get',
			toolbar: '#topBtn',
			title:'评论管理',
			page: true,
            cols: [[
				{checkbox: true, fixed: true}
                ,{field:'id', title: '编号', width:100,align: 'center',fixed: true,sort: true}
                ,{field:'title', title: '文章标题',align: 'center', width:200}
                ,{field:'content', title: '评论内容',align: 'center', width:200}
                ,{field:'created_at', title: '评论时间',align: 'center', width:200,sort: true}
                ,{width:300, title: '操作',align:'center',align: 'center', toolbar: '#barDemo'} 
            ]],
			limit: "{!! config('admin.common_limit') !!}"
        });
		//搜索
        $('#search').on('click', function () {
			var created_at 		= $('#created_at').val();
			var title  			= $('#title').val();
            if ($.trim(created_at) === '' && $.trim(title) === ''){
                layer.msg("{!! config('admin.query_condition') !!}", {icon: 0});
                return;
            }
			tableIn.reload({
				where: {created_at:created_at,title:title}
			});
        });
    });
</script>
@include('admin::layouts.delete_ajax',['url'=>route('blog_admin.comment.destroy')])
@include('admin::layouts.delete_all_ajax',['url'=>route('blog_admin.comment.destroy_all')])
</body>
</html>